fix(managers): sync universe jurisdiction fields for filtering#738
Merged
fix(managers): sync universe jurisdiction fields for filtering#738
Conversation
Contributor
Contributor
🤖 Keepalive Loop StatusPR #738 | Agent: Codex | Iteration 0/5 Current State
🔍 Failure Classification| Error type | infrastructure | |
Contributor
Keepalive Work Log (click to expand)
|
Contributor
There was a problem hiding this comment.
Pull request overview
This PR ensures that manager universe imports (both via the API and the seed_universe.py script) consistently populate both the jurisdiction scalar field and the jurisdictions array field, so that jurisdiction-based list filtering works correctly for managers imported through the universe import flow.
Changes:
api/managers.py: Addsjurisdictionscolumn migration in_ensure_universe_schemaand updates_upsert_universe_recordto writejurisdictionsas a single-element JSON array derived fromjurisdiction.scripts/seed_universe.py: Mirrors theapi/managers.pyschema migration; refactors the upsert logic into a new_upsert_universe_recordfunction that handles presence/absence of the legacyrolecolumn (detected via a new_manager_columnshelper); writesjurisdictionson insert/update.- Tests: Updated existing assertions to include the
jurisdictionscolumn, and added a new end-to-end test verifying jurisdiction filtering returns the correct result after a universe import.
Reviewed changes
Copilot reviewed 4 out of 4 changed files in this pull request and generated 2 comments.
| File | Description |
|---|---|
api/managers.py |
Adds jurisdictions column migration and upsert logic |
scripts/seed_universe.py |
Adds jurisdictions column migration, _manager_columns helper, and refactored upsert |
tests/test_manager_universe_api.py |
Updates existing DB assertions; adds new jurisdiction filter test |
tests/test_seed_universe.py |
Updates existing DB assertions to include jurisdictions |
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
jurisdictionandjurisdictionsso imported managers behave correctly with jurisdiction-based API filtersjurisdictionsin both SQLite and Postgres compatibility pathsseed_universe.pyupsert logic to write synchronized jurisdiction fields and handle schemas with/without legacyrolecolumnjurisdictionsTesting
PYTHONPATH=. pytest -q tests/test_manager_universe_api.py tests/test_seed_universe.pyruff check api/managers.py scripts/seed_universe.py tests/test_manager_universe_api.py tests/test_seed_universe.py